home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Op / rand.ntt < prev    next >
Encoding:
Text File  |  1995-11-07  |  476 b   |  26 lines

  1. #!./perl
  2.  
  3. #From jhi@snakemail.hut.fi Mon May 16 10:36:46 1994
  4. #Date: Sun, 15 May 1994 20:39:09 +0300
  5. #From: Jarkko Hietaniemi <jhi@snakemail.hut.fi>
  6.  
  7. print "1..2\n";
  8.  
  9. $n = 1000;
  10.  
  11. $c = 0;
  12. for (1..$n) {
  13.     last if (rand() > 1 || rand() < 0);
  14.     $c++;
  15. }
  16.  
  17. if ($c == $n) {print "ok 1\n";} else {print "not ok 1\n"}
  18.  
  19. $c = 0;
  20. for (1..$n) {
  21.     last if (rand(10) > 10 || rand(10) < 0);
  22.     $c++;
  23. }
  24.  
  25. if ($c == $n) {print "ok 2\n";} else {print "not ok 2\n"}
  26.